<template>
	<view style="margin: 70upx;">
		<ayQrcode ref="qrcode" :modal="modal_qr" :url="url" @hideQrcode="hideQrcode" :height="300" :width="300"
			 :is_themeImg="true" :themeImg="userImg" :h_w_img="40" />
	</view>
</template>

<script>
	import {
		Storage
	} from '@/static/libs/utils.js'
	import ayQrcode from "@/components/ay-qrcode/ay-qrcode.vue"
	export default {
		components: {
			ayQrcode,

		},
		data() {
			return {
				//二维码相关参数
				modal_qr: false,
				url: '', // 要生成的二维码值
				token: '',
				userImg: ''

			}
		},

		onLoad() {
			this.userImg = Storage.get("avatarUrl");
			this.token = Storage.get('token');
			let that = this;
			that.showQrcode(); //一加载生成二维码

		},
		methods: {

			// 展示二维码
			showQrcode() {
				var baseUrl =
					`https://sxk.scztf.com/wxapp.php?i=undefined&t=undefined&v=undefined&from=wxapp&c=entry&a=wxapp&do=user&m=lionfish_comshop&sign=1a09ac9036d4cbc6a4c765d906db60b6&controller=user.get_user_info&token=${this.token}`
				let _this = this;
				this.modal_qr = true;
				this.url = baseUrl;
				// uni.showLoading()
				setTimeout(function() {
					// uni.hideLoading()
					_this.$refs.qrcode.crtQrCode()
				}, 50)
			},

			//传入组件的方法
			hideQrcode() {
				this.modal_qr = false;
			},
		}

	}
</script>

<style>
</style>
